package blackithei.UDP;

import java.io.IOException;
import java.net.*;

//UDP 广播
public class ClientDemo3 {
    public static void main(String[] args) throws IOException {
        //寻找码头 随机就行
        DatagramSocket ds=new DatagramSocket();
        //创建包裹
        byte[] bytes = "啊,哈哈哈哈!".getBytes();
        //地址
        InetAddress address = InetAddress.getByName("255.255.255.255");
        //端口
        int port=10001;
        DatagramPacket dp=new DatagramPacket(bytes,bytes.length,address,port);
        //传输数据
        ds.send(dp);
        //释放资源
        ds.close();
    }
}
